package com.tc.travel.util;

import java.io.InputStream;
import java.util.Properties;

import com.tc.travel.util.exception.ComRuntimeException;

public class PropertyUtil {
	static Properties properties;

	static {
		InputStream is = null;
		try {
			/**
			 * /dbconfig.properties 绝对路径, 取到的文件是classpath下的 resources/dbconfig.properties 相对路径 获取文件流
			 */
			// 获取到classpath下的文件
			is = Class.forName(PropertyUtil.class.getName()).getResourceAsStream("/config.properties");
			// 获取到package下的文件
			// input =
			// Class.forName(ClassLoaderDemo.class.getName()).getResourceAsStream("resources/dbconfig.properties");

			properties = new Properties();
			properties.load(is);

			// fileGenFold = properties.getProperty("file.gen.fold");
			//
			// dbBdcUrl = properties.getProperty("jdbc.bdcdj.url");
			// dbBdcUser = properties.getProperty("jdbc.bdcdj.username");
			// dbBdcPwd = properties.getProperty("jdbc.bdcdj.password");

		} catch (Exception e) {
			throw new ComRuntimeException("load properties file fail.", e);
		}
	}

	//
	public static boolean isDebug = properties.getProperty("debug") != null && "true".equalsIgnoreCase(properties.getProperty("debug"));

	public static String localTmpFold = properties.getProperty("local.tmp.fold");

	// interface
	public static String interfaceUrlGetCookie = properties.getProperty("interface.url.base") + properties.getProperty("interface.url.get.cookie");

	public static String interfaceUrlVisaGetForAddUpdate = properties.getProperty("interface.url.base") + properties.getProperty("interface.url.visa.get.for.add.update");
	public static String interfaceUrlVisaGetForCancel = properties.getProperty("interface.url.base") + properties.getProperty("interface.url.visa.get.for.cancel");

	public static String interfaceUrlVisaUpdateState = properties.getProperty("interface.url.base") + properties.getProperty("interface.url.visa.update.state");

	// return report
	public static String interfaceUrlVisaGetForImportReturnReport = properties.getProperty("interface.url.base") + properties.getProperty("interface.url.visa.get.for.import.return.report");
	public static String interfaceUrlVisaUpdateReturnReportState = properties.getProperty("interface.url.base") + properties.getProperty("interface.url.visa.update.return.report.state");

	public static String interfaceUrlDownload = properties.getProperty("interface.url.base") + properties.getProperty("interface.url.download");
	public static String interfaceUrlUploadReturnReportPdf = properties.getProperty("interface.url.base") + properties.getProperty("interface.url.upload.return.report.pdf");

	public static String interfaceUrlVisaGetForDownloadReturnReport = properties.getProperty("interface.url.base") + properties.getProperty("interface.url.visa.get.for.download.return.report");
	public static String interfaceUrlVisaUpdateReturnReportDownloadState = properties.getProperty("interface.url.base") + properties.getProperty("interface.url.visa.update.return.report.download.state");

	// dest urls
	public static String destUrlVisaEdit = properties.getProperty("dest.url.visa.edit");
	public static String destUrlGetChinaAgent = properties.getProperty("dest.url.get.china.agent");

	public static String destUrlVisaSearch = properties.getProperty("dest.url.visa.search");

	public static String destUrlVisaCancel = properties.getProperty("dest.url.visa.cancel");

	public static String destUrlIdentityNameList = properties.getProperty("dest.url.identity.name.list");
	public static String destUrlIdentityNameUploadEdit = properties.getProperty("dest.url.identity.name.upload.edit");

	public static String destUrlIdentityReturnEdit = properties.getProperty("dest.url.identity.return.edit");
	public static String destUrlIdentityNameEdit = properties.getProperty("dest.url.identity.name.edit");

	public static String destUrlDownloadReturnReport = properties.getProperty("dest.url.download.return.report");

}
